if( $('.hero-slider').length > 0 ) {
    $('.hero-slider').flexslider( {
        animation: 'fade',
        animationSpeed: 1000,
        animationLoop: true,
        prevText: '',
        nextText: '',
        before: function(slider) {
            $('.hs-caption').fadeOut().animate({top:'-80px'},{queue:false, easing: 'swing', duration: 700});
            slider.slides.eq(slider.currentSlide).delay(500);
            slider.slides.eq(slider.animatingTo).delay(500);
        },
        after: function() {
            $('.hs-caption').fadeIn().animate({top:'0'},{queue:false, easing: 'swing', duration: 700});
        },
        useCSS: true
    });
}

var homeSection = $('.home-section');
buildHomeSection(homeSection);
$(window).resize(function() {
    buildHomeSection(homeSection);
});
/* ---------------------------------------------- /*
 * Home section height
 /* ---------------------------------------------- */

function buildHomeSection(homeSection) {
    if (homeSection.length > 0) {
        if (homeSection.hasClass('home-full-height')) {
            homeSection.height($(window).height());
        } else {
            if ( !homeSection.hasClass('home-slider-plugin') ) {
                homeSection.height($(window).height() * 0.85);
            }
        }
    }
}